//
//  TableCellFactory.swift
//  Exchange
//
//  Created by 孟祥群 on 2018/7/25.
//  Copyright © 2018年 common. All rights reserved.
//

import UIKit

class TableCellFactory: NSObject {
    var iteamArray:[[CYTableviewItem]] = []
    func cellClassAtIndexPath(_ indexPath:IndexPath) -> AnyClass {
        let item = self.itemAtIndexPath(indexPath)
        switch item.type! {
        case .cyItemCountry:
            return CountryNumberCell.self
        case .cyItemNumber:
            return NumberWriteCell.self
        case .cyItemTimer:
            return TimerTableCell.self
        case .cyPassWord:
            return PassWordWriteCell.self
        case .cyNameWrite:
            return NameWriteCell.self
        case .cyadvertSelectType:
            return AdverSelectCell.self
        case .cyMessageType:
            return AdverContentCell.self
        case .cyOpenTimeType:
            return OpenTimeTableViewCell.self
        case .cyAddTimeType:
            return AddTimeCell.self
        case .cyShowTimeType:
            return TimeTableViewCell.self
        case .cySwitchType:
            return SwitchTableCell.self
        default :
            return BaseTableViewCell.self
        }
    }
    
    func cellIdentiferAtIndexPath(_ indexPath:IndexPath) -> String {
        return NSStringFromClass(self.cellClassAtIndexPath(indexPath))
    }
    
    func itemAtIndexPath(_ indexPath:IndexPath) -> CYTableviewItem {
        return iteamArray[indexPath.section][indexPath.row]
    }
    
}
